package com.corn.factory;

import com.corn.entity.Car;

import java.util.HashMap;
import java.util.Map;

public class InstanceCarFactory {
    private Map<Integer,Car> carMap;
    public InstanceCarFactory(){
        carMap = new HashMap<>();
        carMap.put(1,new Car(1,"奔驰"));
        carMap.put(2,new Car(2,"现代"));
    }
    public Car getCar(Integer num){
        return carMap.get(num);
    }
}
